/* Check JER_BM_To_Schedule_Dumb(). */
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include "reed_sol-2.h"
#include "liberation-2.h"
#include "jerasure-2.h"
#include "galois-2.h"

using namespace std;

int main( int argc, char** argv )
{
	JER_Matrix *jm;
	JER_Bitmatrix *jbm;
	vector <JER_Schedule *> *schedule_cache;

	int m = atoi( argv[1] );
	int k = atoi( argv[2] );
	int w = atoi( argv[3] );
	int i, j;
	jbm = liberation_coding_bitmatrix( k, w );
	jbm->Print();
	schedule_cache = JER_RAID_6_Schedule_Cache( jbm, 0 );
	fprintf( stdout, "Cache size = %d\n", (int)(schedule_cache->size()) );

	for( j = 0; j < schedule_cache->size(); j++ )
	{
		for( i = 0; i <  (*schedule_cache)[j]->Elts.size(); i++ )
		{
			fprintf( stdout, "<%d,%d,%d,%d,%d>\n", 
					(*schedule_cache)[j]->Elts[i][4], 
					(*schedule_cache)[j]->Elts[i][0], 
					(*schedule_cache)[j]->Elts[i][1], 
					(*schedule_cache)[j]->Elts[i][2], 
					(*schedule_cache)[j]->Elts[i][3] );
		}
	}

	return 0;
}
